﻿<table class="table">
    <thead>
        <tr>
            <th>Date</th>
            <th>Temp. (C)</th>
            <th>Temp. (F)</th>
            <th>Summary</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var forecast in Forecasts)
        {
            <tr>
                <td>@forecast.Date.ToShortDateString()</td>
                <td>@forecast.TemperatureC</td>
                <td>@forecast.TemperatureF</td>
                <td>@forecast.Summary</td>
            </tr>
        }
    </tbody>
</table>
@code{
    private WeatherForecast[] _forecasts = Array.Empty<WeatherForecast>();
    
    [Parameter]
    public WeatherForecast[] Forecasts
    {
        get => _forecasts;
        set => _forecasts = value ?? Array.Empty<WeatherForecast>();
    }
}